//
//  YLRegularFinancingTableViewCell.m
//  YLFinanceService
//
//  Created by she1323 on 2017/9/13.
//  Copyright © 2017年 she1323. All rights reserved.
//  订单列表

#import "YLRegularFinancingTableViewCell.h"
#import "YLGlobeHeader.h"
#import "YLContinuationOrderModel.h"
@interface YLRegularFinancingTableViewCell ()
// 可续投
@property (weak, nonatomic) IBOutlet UILabel *continueLabel;
// 投资金额
@property (weak, nonatomic) IBOutlet UILabel *investmentAmountLabel;
// 收益到期日
@property (weak, nonatomic) IBOutlet UILabel *maturityDateLabel;
// 预期本息
@property (weak, nonatomic) IBOutlet UILabel *expectedPrincipalLabel;
// 产品名称
@property (weak, nonatomic) IBOutlet UILabel *productNameLabel;
@property (weak, nonatomic) IBOutlet UIImageView *icon;

@end

@implementation YLRegularFinancingTableViewCell

- (void)awakeFromNib {
    [super awakeFromNib];
    
    _continueLabel.layer.masksToBounds = YES;
    _continueLabel.layer.cornerRadius = 2.0;
    _continueLabel.backgroundColor = YLLOrgColor;
}

- (void)setModel:(YLContinuationOrderModel *)model
{
    _model = model;
    
    _investmentAmountLabel.text = [NSString stringWithFormat:@"%.2f", model.investmentAmount];
    
    _maturityDateLabel.text = model.calulationEndDate;
    
    _expectedPrincipalLabel.text = [NSString stringWithFormat:@"%.2f", model.expectAllBackAmount];
    
    _continueLabel.hidden = !model.isContinuedInvestment;
    
    _productNameLabel.text = model.productName;
    
    _icon.hidden = YES;
    if (model.approvalStatus == -8) {
        // 作废
        _icon.hidden = NO;
        _icon.image = [UIImage imageNamed:@"abandoned"];
    } else if (model.approvalStatus == 10) {
        // 已经赎回
        _icon.hidden = NO;
        _icon.image = [UIImage imageNamed:@"calledAway"];
    }
    
//    _icon.hidden = NO;
//    _icon.image = [UIImage imageNamed:@"abandoned"];
    
}


+ (NSString *)cellID
{
    return @"YLRegularFinancingTableViewCell";
}

- (void)setSelected:(BOOL)selected animated:(BOOL)animated {
    [super setSelected:selected animated:animated];

    // Configure the view for the selected state
}

@end
